﻿using Microsoft.Extensions.Logging;
using NetCore.IRepository.SysOndutytype;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace NetCore.Repository.SysOndutytype
{
    public class SysOndutytype : BaseRepository<NetCore.Model.Enity.SysOndutytype>, ISysOndutytype
    {
        private readonly ILogger<SysOndutytype> _logger;

        public SysOndutytype(ILogger<SysOndutytype> Logger)
        {
            _logger = Logger;
        }

        /// <summary>
        /// 获取班次类型信息
        /// </summary>
        /// <returns></returns>
        public async Task<List<NetCore.Model.Enity.SysOndutytype>> GetSysOndutytypes()
        {
            List<Model.Enity.SysOndutytype> sysOndutytypes = new List<Model.Enity.SysOndutytype>();
            try
            {
                sysOndutytypes = await Db.Queryable<Model.Enity.SysOndutytype>().ToListAsync();
                return sysOndutytypes;
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                return sysOndutytypes;
            }
        }
    }
}